#include "precomp.h"
#include "jatomic.h"
#include <qatomic.h>

// - class JBasicAtomicIntPrivate -

/**
 * @brief The JBasicAtomicIntPrivate class
 */
class JBasicAtomicIntPrivate : public QBasicAtomicInt
{
public:
    JBasicAtomicIntPrivate(int value)
    {
        QBasicAtomicInt::operator =(value);
    }
};

// - class JBasicAtomicInt -

/**
 * @brief JBasicAtomicInt::JBasicAtomicInt
 */
JBasicAtomicInt::JBasicAtomicInt()
{
    d = new JBasicAtomicIntPrivate(1);
}

/**
 * @brief JBasicAtomicInt::JBasicAtomicInt
 * @param value
 */
JBasicAtomicInt::JBasicAtomicInt(int value)
{
    d = new JBasicAtomicIntPrivate(value);
}

/**
 * @brief JBasicAtomicInt::~JBasicAtomicInt
 */
JBasicAtomicInt::~JBasicAtomicInt()
{
    delete d;
}

/**
 * @brief JBasicAtomicInt::operator ==
 * @param value
 * @return
 */
bool JBasicAtomicInt::operator==(int value) const
{
    return d->operator ==(value);
}

/**
 * @brief JBasicAtomicInt::operator !=
 * @param value
 * @return
 */
bool JBasicAtomicInt::operator!=(int value) const
{
    return d->operator !=(value);
}

/**
 * @brief JBasicAtomicInt::operator !
 * @return
 */
bool JBasicAtomicInt::operator!() const
{
    return d->operator !();
}

/**
 * @brief JBasicAtomicInt::value
 * @return
 */
int JBasicAtomicInt::value() const
{
    return d->_q_value;
}

/**
 * @brief JBasicAtomicInt::setValue
 * @param value
 */
void JBasicAtomicInt::setValue(int value)
{
    d->_q_value = value;
}

/**
 * @brief JBasicAtomicInt::operator int
 */
JBasicAtomicInt::operator int() const
{
    return d->operator int();
}

/**
 * @brief JBasicAtomicInt::isReferenceCountingNative
 * @return
 */
bool JBasicAtomicInt::isReferenceCountingNative()
{
    return QBasicAtomicInt::isReferenceCountingNative();
}

/**
 * @brief JBasicAtomicInt::isReferenceCountingWaitFree
 * @return
 */
bool JBasicAtomicInt::isReferenceCountingWaitFree()
{
    return QBasicAtomicInt::isReferenceCountingWaitFree();
}

/**
 * @brief JBasicAtomicInt::ref
 * @return
 */
bool JBasicAtomicInt::ref()
{
    return d->ref();
}

/**
 * @brief JBasicAtomicInt::deref
 * @return
 */
bool JBasicAtomicInt::deref()
{
    return d->deref();
}

/**
 * @brief JBasicAtomicInt::isTestAndSetNative
 * @return
 */
bool JBasicAtomicInt::isTestAndSetNative()
{
    return QBasicAtomicInt::isTestAndSetNative();
}

/**
 * @brief JBasicAtomicInt::isTestAndSetWaitFree
 * @return
 */
bool JBasicAtomicInt::isTestAndSetWaitFree()
{
    return QBasicAtomicInt::isTestAndSetWaitFree();
}

/**
 * @brief JBasicAtomicInt::testAndSetRelaxed
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
{
    return d->testAndSetRelaxed(expectedValue, newValue);
}

/**
 * @brief JBasicAtomicInt::testAndSetAcquire
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
{
    return d->testAndSetAcquire(expectedValue, newValue);
}

/**
 * @brief JBasicAtomicInt::testAndSetRelease
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue)
{
    return d->testAndSetRelease(expectedValue, newValue);
}

/**
 * @brief JBasicAtomicInt::testAndSetOrdered
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
{
    return d->testAndSetOrdered(expectedValue, newValue);
}

/**
 * @brief JBasicAtomicInt::isFetchAndStoreNative
 * @return
 */
bool JBasicAtomicInt::isFetchAndStoreNative()
{
    return QBasicAtomicInt::isFetchAndStoreNative();
}

/**
 * @brief JBasicAtomicInt::isFetchAndStoreWaitFree
 * @return
 */
bool JBasicAtomicInt::isFetchAndStoreWaitFree()
{
    return QBasicAtomicInt::isFetchAndStoreWaitFree();
}

/**
 * @brief JBasicAtomicInt::fetchAndStoreRelaxed
 * @param newValue
 * @return
 */
int JBasicAtomicInt::fetchAndStoreRelaxed(int newValue)
{
    return d->fetchAndStoreRelaxed(newValue);
}

/**
 * @brief JBasicAtomicInt::fetchAndStoreAcquire
 * @param newValue
 * @return
 */
int JBasicAtomicInt::fetchAndStoreAcquire(int newValue)
{
    return d->fetchAndStoreAcquire(newValue);
}

/**
 * @brief JBasicAtomicInt::fetchAndStoreRelease
 * @param newValue
 * @return
 */
int JBasicAtomicInt::fetchAndStoreRelease(int newValue)
{
    return d->fetchAndStoreRelease(newValue);
}

/**
 * @brief JBasicAtomicInt::fetchAndStoreOrdered
 * @param newValue
 * @return
 */
int JBasicAtomicInt::fetchAndStoreOrdered(int newValue)
{
    return d->fetchAndStoreOrdered(newValue);
}

/**
 * @brief JBasicAtomicInt::isFetchAndAddNative
 * @return
 */
bool JBasicAtomicInt::isFetchAndAddNative()
{
    return QBasicAtomicInt::isFetchAndAddNative();
}

/**
 * @brief JBasicAtomicInt::isFetchAndAddWaitFree
 * @return
 */
bool JBasicAtomicInt::isFetchAndAddWaitFree()
{
    return QBasicAtomicInt::isFetchAndAddWaitFree();
}

/**
 * @brief JBasicAtomicInt::fetchAndAddRelaxed
 * @param valueToAdd
 * @return
 */
int JBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd)
{
    return d->fetchAndAddRelaxed(valueToAdd);
}

/**
 * @brief JBasicAtomicInt::fetchAndAddAcquire
 * @param valueToAdd
 * @return
 */
int JBasicAtomicInt::fetchAndAddAcquire(int valueToAdd)
{
    return d->fetchAndAddAcquire(valueToAdd);
}

/**
 * @brief JBasicAtomicInt::fetchAndAddRelease
 * @param valueToAdd
 * @return
 */
int JBasicAtomicInt::fetchAndAddRelease(int valueToAdd)
{
    return d->fetchAndAddRelease(valueToAdd);
}

/**
 * @brief JBasicAtomicInt::fetchAndAddOrdered
 * @param valueToAdd
 * @return
 */
int JBasicAtomicInt::fetchAndAddOrdered(int valueToAdd)
{
    return d->fetchAndAddOrdered(valueToAdd);
}

// - class JAtomicIncPrivate -

/**
 * @brief The JAtomicIntPrivate class
 */
class JAtomicIntPrivate : public QAtomicInt
{
    friend class JAtomicInc;
public:
    JAtomicIntPrivate(int value)
        : QAtomicInt(value)
    {

    }
};

// - class JAtomicInc -

/**
 * @brief JAtomicInt::JAtomicInt
 * @param value
 */
JAtomicInt::JAtomicInt(int value)
{
    d = new JAtomicIntPrivate(value);
}

/**
 * @brief JAtomicInt::~JAtomicInt
 */
JAtomicInt::~JAtomicInt()
{
    delete d;
}

/**
 * @brief JAtomicInt::JAtomicInt
 * @param other
 */
JAtomicInt::JAtomicInt(const JAtomicInt &other)
{
    d->_q_value = other.d->_q_value;
}

/**
 * @brief JAtomicInt::operator =
 * @param value
 * @return
 */
JAtomicInt &JAtomicInt::operator =(int value)
{
    d->operator =(value);
    return *this;
}

/**
 * @brief JAtomicInt::operator =
 * @param other
 * @return
 */
JAtomicInt &JAtomicInt::operator =(const JAtomicInt &other)
{
    d->operator =(*other.d);
    return *this;
}

/**
 * @brief JAtomicInt::operator ==
 * @param value
 * @return
 */
bool JAtomicInt::operator ==(int value) const
{
    return d->operator ==(value);
}

/**
 * @brief JAtomicInt::operator !=
 * @param value
 * @return
 */
bool JAtomicInt::operator !=(int value) const
{
    return d->operator !=(value);
}

/**
 * @brief JAtomicInt::operator !
 * @return
 */
bool JAtomicInt::operator !() const
{
    return d->operator !();
}

/**
 * @brief JAtomicInt::operator int
 */
JAtomicInt::operator int() const
{
    return d->operator int();
}

/**
 * @brief JAtomicInt::isReferenceCountingNative
 * @return
 */
bool JAtomicInt::isReferenceCountingNative()
{
    return QBasicAtomicInt::isReferenceCountingNative();
}

/**
 * @brief JAtomicInt::isReferenceCountingWaitFree
 * @return
 */
bool JAtomicInt::isReferenceCountingWaitFree()
{
    return QBasicAtomicInt::isReferenceCountingWaitFree();
}

/**
 * @brief JAtomicInt::ref
 * @return
 */
bool JAtomicInt::ref()
{
    return d->ref();
}

/**
 * @brief JAtomicInt::deref
 * @return
 */
bool JAtomicInt::deref()
{
    return d->deref();
}

/**
 * @brief JAtomicInt::isTestAndSetNative
 * @return
 */
bool JAtomicInt::isTestAndSetNative()
{
    return QBasicAtomicInt::isTestAndSetNative();
}

/**
 * @brief JAtomicInt::isTestAndSetWaitFree
 * @return
 */
bool JAtomicInt::isTestAndSetWaitFree()
{
    return QBasicAtomicInt::isTestAndSetWaitFree();
}

/**
 * @brief JAtomicInt::testAndSetRelaxed
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JAtomicInt::testAndSetRelaxed(int expectedValue, int newValue)
{
    return d->testAndSetRelaxed(expectedValue, newValue);
}

/**
 * @brief JAtomicInt::testAndSetAcquire
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JAtomicInt::testAndSetAcquire(int expectedValue, int newValue)
{
    return d->testAndSetAcquire(expectedValue, newValue);
}

/**
 * @brief JAtomicInt::testAndSetRelease
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JAtomicInt::testAndSetRelease(int expectedValue, int newValue)
{
    return d->testAndSetRelease(expectedValue, newValue);
}

/**
 * @brief JAtomicInt::testAndSetOrdered
 * @param expectedValue
 * @param newValue
 * @return
 */
bool JAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
{
    return d->testAndSetOrdered(expectedValue, newValue);
}

/**
 * @brief JAtomicInt::isFetchAndStoreNative
 * @return
 */
bool JAtomicInt::isFetchAndStoreNative()
{
    return QBasicAtomicInt::isFetchAndStoreNative();
}

/**
 * @brief JAtomicInt::isFetchAndStoreWaitFree
 * @return
 */
bool JAtomicInt::isFetchAndStoreWaitFree()
{
    return QBasicAtomicInt::isFetchAndStoreWaitFree();
}

/**
 * @brief JAtomicInt::fetchAndStoreRelaxed
 * @param newValue
 * @return
 */
int JAtomicInt::fetchAndStoreRelaxed(int newValue)
{
    return d->fetchAndStoreRelaxed(newValue);
}

/**
 * @brief JAtomicInt::fetchAndStoreAcquire
 * @param newValue
 * @return
 */
int JAtomicInt::fetchAndStoreAcquire(int newValue)
{
    return d->fetchAndStoreAcquire(newValue);
}

/**
 * @brief JAtomicInt::fetchAndStoreOrdered
 * @param newValue
 * @return
 */
int JAtomicInt::fetchAndStoreOrdered(int newValue)
{
    return d->fetchAndStoreOrdered(newValue);
}

/**
 * @brief JAtomicInt::isFetchAndAddNative
 * @return
 */
bool JAtomicInt::isFetchAndAddNative()
{
    return QBasicAtomicInt::isFetchAndAddNative();
}

/**
 * @brief JAtomicInt::isFetchAndAddWaitFree
 * @return
 */
bool JAtomicInt::isFetchAndAddWaitFree()
{
    return QBasicAtomicInt::isFetchAndAddWaitFree();
}

/**
 * @brief JAtomicInt::fetchAndAddRelaxed
 * @param valueToAdd
 * @return
 */
int JAtomicInt::fetchAndAddRelaxed(int valueToAdd)
{
    return d->fetchAndAddRelaxed(valueToAdd);
}

/**
 * @brief JAtomicInt::fetchAndAddAcquire
 * @param valueToAdd
 * @return
 */
int JAtomicInt::fetchAndAddAcquire(int valueToAdd)
{
    return d->fetchAndAddAcquire(valueToAdd);
}

/**
 * @brief JAtomicInt::fetchAndAddRelease
 * @param valueToAdd
 * @return
 */
int JAtomicInt::fetchAndAddRelease(int valueToAdd)
{
    return d->fetchAndAddRelease(valueToAdd);
}

/**
 * @brief JAtomicInt::fetchAndAddOrdered
 * @param valueToAdd
 * @return
 */
int JAtomicInt::fetchAndAddOrdered(int valueToAdd)
{
    return d->fetchAndAddOrdered(valueToAdd);
}
